package com.ddyx.rest;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ddyx.common.util.RequestForm;
import com.ddyx.common.util.ResponseForm;
import com.ddyx.service.ITaskService;

/**
 * @author cj
 */
@Controller
@RequestMapping("/task")
public class TaskController {

	@Resource
	ITaskService iTaskService;
	
	/**
	 * 获取任务列表接口
	 * @param requestForm
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/getTaskInfo", method = RequestMethod.POST)
	public String getTaskInfo(@RequestBody RequestForm requestForm) {
		return iTaskService.getTaskInfoByIdPage(requestForm);
	}
	
	/**
	 * 任务添加接口
	 * @param requestForm
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/addTask", method = RequestMethod.POST)
	public ResponseForm addTask(@RequestBody RequestForm requestForm) {
		return iTaskService.addTask(requestForm);
	}
	
	/**
	 * 任务删除接口
	 * @param requestForm
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/deleteTask", method = RequestMethod.POST)
	public ResponseForm deleteTask(@RequestBody RequestForm requestForm) {
		return iTaskService.deleteTask(requestForm);
	}
	
	/**
	 * 任务修改接口
	 * @param requestForm
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/modifyTask", method = RequestMethod.POST)
	public ResponseForm modifyTask(@RequestBody RequestForm requestForm) {
		return iTaskService.modifyTask(requestForm);
	}
}
